"""
在搜索框输入一个内容 返回下拉菜单中所有的选项
"""
from time import sleep
from selenium import webdriver
from selenium.webdriver import ActionChains
from selenium.webdriver.common.by import By

user_input = input('请输入你想搜索的内容: ')

driver = webdriver.Chrome()
url = 'https://www.baidu.com/'
driver.get(url)
sleep(2)

# 获取并发送内容
ipt = driver.find_element(By.ID, 'kw')
ipt.send_keys(user_input)
click = driver.find_element(By.ID, 'su')

# 鼠标悬浮
ActionChains(driver).move_to_element(ipt).perform()
ul = driver.find_element(By.ID, 'normalSugSearchUl')
all_li = ul.find_elements(By.TAG_NAME, 'li')
for li in all_li:
    print(li.text)